﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using U.B.DoMain;
using U.B.ErrorCode;
using U.B.ReadApi.Command;

namespace U.B.ReadApi.Controllers
{
    [Route("api/[controller] /[action]")]
    [ApiController]
    public class LevaAppController : ControllerBase
    {
        public readonly IMediator mediator;
        public LevaAppController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 请假申请查询显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Apipage<LeaveApp>> GetLeave([FromQuery] GetLeaveCommand request)
        {
            return await mediator.Send(request);

        }
        /// <summary>
        /// 领导人显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<string>> GetLeader([FromQuery] GetLeaderCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<LeaveApp>> GetLAId([FromQuery] GetLAIdCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 审批记录反填
        /// </summary>
        /// <param name="request">LAId</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<Approval>>> GetApproval([FromQuery] GetAppCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
